install-node and uninstall-node

Overview of install-node

Install node provisions GlassFish software on the host(s) specified as the operand to the command. The command creates an archive of the GlassFish installation, if needed, from the DAS installation. The location of the archive file can either be specified as an option, or defaulted to either the base root of the DAS installation, if writeable, or to the directory referred to by the system property java.io.tmpdir. The archive created does not contain the domains or nodes directory. These are synced when the instance is created and started. If multiple hosts are specified, they are all configured the same (in terms
of SSH credentials and install-location).

Command Usage

install-node doesn't store any configuration information in domain.xml. It is a local command with the following usage:

Usage: asadmin [asadmin-utility-options] install-node [--sshuser <sshuser>]
	[--sshport <sshport(default:22)>] [--sshkeyfile <sshkeyfile>] 
        [--archiveDir <archive dir>] [--interactive <default:true>]
        [--install-location <location to install>]  [--recreate]
	[-?|--help[=<help(default:false)>]] hosts ...

where the username is the username to use for the remote login (default: user id of asadmin user) port is the port of the sshd server on remote node (default: 22)sshkeyfile is the location of the private key file (default: $HOME/.ssh/id_rsa) archiveDir is the directory on the DAS where the archive is created (defaults to either the base-root of the installation if it is writeable or to the directory pointed to by the system property java.io.tmpdir) install-location - is The location on the remote system where the glassfish bundle will be installed. This directory corresponds to the top most glassfish
install directory, for example: "/opt/glassfishv3". (note the current implementation has bug where install-location is required to be the parent directory of glassfishv3, i.e."/opt" in this case).

Archive creation

The GlassFish archive is created from the DAS installation. To create the archive first we look at the archiveDir, if specified, and see if a glassfish.zip already exists. If it does then it will use the file at the location and not recreate the archive. If there is no glassfish.zipit is indeed writeable. If an archiveDir is specified, and is not writeable by the user as which the asadmin is running, then a CommandException will be thrown. If no archiveDir is specified, then the base root of the current installation is used as the location if it is writeable, else the location specified by the system property java.io.tmpdir is used. The base root is determined by the running the hidden command __locations. The archive contains all files relative to the glassfishv3 directory except the domains and nodes directories. The archive also contains the IPS meta-data (currently a bug in the implementation which we will fix) so the installation can be updated using the update center. There is a --recreate option which forces the creation of the archive even if one exists.

Install Location

The install-location, if specified, will be used as the location on the remote system to install the software. To the install location today we append glassfishv3/glassfish. If the directory does not exist, the directory for the install-location will be created and the bits will be unzipped at the location. After the installation occurs, the permissions for files in the glassfishv3/glassfish/bin directory are set so that the scripts can be executed. If there is already an installation of glassfish then the installation will fail with a CommandException and a message stating that an installation already exists at the specified location. If the directory specified via the install-location is not writeable by the user that the DAS is running as, a CommandException will be thrown with an error message indicating the same. If no install-location is specified, the default install location is the same location as the DAS.

Interactive install-node

In the case when the ssh keys have not been setup, the install-node commmand is interactive by default. The command, when run, will prompt for a password for the specified ssh user. There is a --interactive parameter that the command takes that can be used to run in non-interactive mode (for automation of scripts). In that case a password file can be specified where the ssh password / alias to the password is specified.

Examples

Example 1: Where the ssh keys have been setup and the user name on the remote system is the same as the user that the DAS is running as.

$ asadmin install-node  nine.us.oracle.com
SSH public key authentication is already configured for the DAS on nine and the ssh user is assumed to be the same as the user that the DAS is running as.

Example 2: Specify a different sshuser

$ asadmin install-node  --sshuser=mode nine.us.oracle.com

Example 3: Specify a different sshuser and the password for the user is specified via the passwordfile. Can optionally be made non-interactive with --interactive=false

$ asadmin install-node  --sshuser=mode --passwordfile=/tmp/passwordfile nine.us.oracle.com

Example 4: Force recreation of archive and specify archiveDir

$ asadmin install-node  --recreate=true --archiveDir=/home/rajiv/tmp/glassfish-archive-dir nine.us.oracle.com

Example 5: Specify install-location

$ asadmin install-node  --recreate=true --install-location=/opt/glassfish3 nine.us.oracle.com

Overview of uninstall-node

The uninstall-node command uninstalls the glassfish software on the specified host(s). Before uninstalling the command validates that no nodes refer to the host in the configuration. If any node exists in the configuration that points to the specified host, then a CommandException is thrown indicating the same and asks the user to run delete-node-ssh before running uninstall-node.

Command usage:

Usage: asadmin [asadmin-utility-options] uninstall-node [--sshuser <sshuser>]
	[--sshport <sshport(default:22)>] [--sshkeyfile <sshkeyfile>]
        [--install-location <location to install>]
	[-?|--help[=<help(default:false)>]] hosts ...

The options to uninstall-node are almost the same as install-node. Except uninstall-node does not take an archiveDir parameter, interactive parameter and the recreate parameter.

Open issues

  • --install-location vs. create-node-ssh --installdir
  • Should we support a "--install" and "--uninstall" option on create-node-ssh and delete-node-ssh? What about update-node-ssh when a node is created via create-node-config and then "upgraded" to an ssh node via update-node-ssh.